package com.ld.admin.controller.system;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import com.ld.admin.controller.AdminBasicController;
import com.ld.admin.model.system.SystemUser;
import com.ld.admin.service.user.IUserService;
import com.ld.shieldsb.annotation.NoLog;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;

/**
 * 
 * 系统公共controller
 * 
 * @ClassName SystemCommonController
 * @author 吕凯
 * @date 2019年08月16日 09:37:09
 *
 */
@Api(tags = "系统公共controller")
@ConditionalOnProperty(prefix = "modules.sc.system", name = "common.enable", havingValue = "true", matchIfMissing = true)
@Controller(value = "SystemCommonController")
@RequestMapping("${shieldsb.adminPath}/system/common")
public class SystemCommonController extends AdminBasicController<SystemUser> {
    @Autowired
    protected IUserService userService;

    @NoLog("aop日志不记录")
    @ApiOperation(value = "获取用户", notes = "")
    @RequestMapping(path = "/getUsers", method = RequestMethod.POST)
    public String getUsers() {
        String name = getString("name");
        Long id = getLong("id");
        List<SystemUser> list = userService.getUsersByNameOrId(name, id, 20);
        request.setAttribute("users", list);
        return "a/system/common/include_users";
    }
}